package com.nulldev.util.concurrency.threadIt.v4.emapi.testing;

import com.nulldev.util.JVM.JVM;
import com.nulldev.util.VariableAPI.ArrayUtils;
import com.nulldev.util.concurrency.threadIt.v4.emapi.ExecutorManager;
import com.nulldev.util.concurrency.threadIt.v4.emapi.extensions.ExtendedExecutor;
import com.nulldev.util.concurrency.threadIt.v4.executors.bqde.BQDE;

public class BatchSubmissionTest {

	public static void main(String[] args) {
		ExecutorManager.get().setExecutor(new BQDE(48, 4));
		JVM.println("Executor: " + ExecutorManager.get().executor());
		if (ExecutorManager.get().executor() instanceof ExtendedExecutor) {
			JVM.println("Extensions: ");
			ArrayUtils.printLln(((ExtendedExecutor) ExecutorManager.get().executor()).supported());
		}
		final Runnable[] r = new Runnable[96];
		for (int i = 0; i < r.length; i++) {
			final int _i = i;
			r[_i] = new Runnable() {

				@Override
				public void run() {
					JVM.println("Hello from task " + (_i + 1) + "!");
				}
			};
		}
		ExecutorManager.get().asyncSubmitAll(r);
	}
}
